package business.service.card.impl;

import java.sql.SQLException;

import business.entity.Card;
import business.service.card.ICardDetailViewService;

import app.MyApplication;
import ui.model.card.CardDetailViewModel;
import util.data.carddao.ICardDataContext;


public class CardDetailViewService implements ICardDetailViewService {
	private CardDetailViewModel viewModel = null;
	private ICardDataContext dct = null;
	
	public CardDetailViewService(CardDetailViewModel v) {
		this.viewModel = v;
		dct = MyApplication.cardDataContext;
	}

	@Override
	public boolean listCard(int Id) throws SQLException {
		Card card = dct.queryById(Id);
		viewModel.setCard(card);
		viewModel.fireOnUpdated();
		return true;
	}

	@Override
	public Card search(int id) throws SQLException {
		Card card = dct.queryById(id);
		return card;
	}

}
